<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易相册</title>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        h1 {
            color: #333;
            text-align: center;
            margin-bottom: 30px;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
        }
        .upload-form {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-bottom: 30px;
        }
        .upload-form h2 {
            margin-top: 0;
            color: #555;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .btn-upload {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }
        .btn-upload:hover {
            background-color: #45a049;
        }
        .gallery {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            grid-gap: 20px;
        }
        .image-card {
            background-color: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            transition: transform 0.3s;
        }
        .image-card:hover {
            transform: translateY(-5px);
        }
        .image-container {
            height: 200px;
            overflow: hidden;
        }
        .image-container img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s;
        }
        .image-card:hover .image-container img {
            transform: scale(1.05);
        }
        .image-info {
            padding: 10px;
        }
        .image-info h3 {
            margin: 0;
            font-size: 16px;
            color: #333;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .empty-gallery {
            text-align: center;
            padding: 50px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>我的简易相册</h1>
        
        <div class="upload-form">
            <h2>上传新图片</h2>
            <form action="/upload" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <input type="file" name="file" accept=".jpg,.jpeg,.png,.gif" required>
                </div>
                <button type="submit" class="btn-upload">上传图片</button>
            </form>
        </div>
        
        <div class="gallery">
            {% if images %}
                {% for image in images %}
                <div class="image-card">
                    <div class="image-container">
                        <img src="{{ url_for('static', filename=image.url) }}" alt="{{ image.filename }}">
                    </div>
                    <div class="image-info">
                        <h3>{{ image.filename }}</h3>
                    </div>
                </div>
                {% endfor %}
            {% else %}
                <div class="empty-gallery">
                    <p>暂无图片，请上传一些图片来开始您的相册！</p>
                </div>
            {% endif %}
        </div>
    </div>
</body>
</html> 